<template>
  <div>
    <h3>支付成功</h3>
    <ul>
      <li>订单号:{{order.order_id}}</li>
      <li>商品:{{order.subject}}</li>
      <li>金额:{{order.amount}}</li>
      <li>支付时间:{{order.time}}</li>
    </ul>
    <a href="/">回首页</a>
  </div>
</template>

<script>
  export default {
    name: "PayMent",
    data(){
      return {
        query:'', // 从连接上, 取到的查询字符串
        order:{}, // 后端返回的订单信息
      }
    },
    created() {
      this.query = this.$route.query
      // 把支付结果发给后端
      this.axios.post('/payment/callback/',{query:this.query}).then(res=>{
        // 3.  非法,     信息有误,   成功
        if(res.data.code=='0'){
          alert(res.data.msg)
          this.order = res.data.order
        }else{
          alert(res.data.msg)
        }
      })
    }
  }
</script>

<style scoped>

</style>